﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EmailConfig.aspx.cs" Inherits="Whir_System_Module_Config_EmailConfig" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>邮箱设置</title>
    <link href="../../Skin/Default/Css/main.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript">
        if (top.location == self.location) { 
            top.location='../../Default.aspx';
        } 
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DADADA">
            <tr>
                <td height="26" colspan="2" align="left" class="form_title"><strong>邮箱设置</strong></td>
            </tr>
            <tr>
                <td width="40%" height="30" align="center" class="form_tdText"><b>发送人邮箱</b> </td>
                <td width="60%" class="form_td">
                    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                    <whir:ezValidatorMessage ID="EzValidatorMessage1" runat="server" ControlToValidate="txtEmail"
                        ErrorMessage="请输入正确的邮箱地址!" ValidateGroup="Group1" ValidatoringType="Email"></whir:ezValidatorMessage>
                </td>
            </tr>
            <tr>
                <td height="30" align="center" class="form_tdText"><b>发送邮件服务器(SMTP)</b> </td>
                <td class="form_td">
                    <asp:TextBox ID="txtSMTP" runat="server"></asp:TextBox>
                    <whir:ezValidatorMessage ID="EzValidatorMessage2" runat="server" ControlToValidate="txtSMTP"
                        ErrorMessage="请输入SMTP!" ValidateGroup="Group1" ValidatoringType="Require"></whir:ezValidatorMessage>
                    <br>
                    <span class="form_desc">用来发送邮件的SMTP服务器，如果你不清楚此参数含义，请联系你的空间商</span> </td>
            </tr>
            <tr>
                <td height="30" align="center" class="form_tdText"><b>端口号</b> </td>
                <td class="form_td">
                    <asp:TextBox ID="txtPort" runat="server"></asp:TextBox>
                    <whir:ezValidatorMessage ID="EzValidatorMessage3" runat="server" ControlToValidate="txtPort"
                        ErrorMessage="请输入端口号!" ValidateGroup="Group1" ValidatoringType="Number"></whir:ezValidatorMessage>
                    <br>
                    <span class="form_desc">端口号必需是非负整正数，默认是25端口</span> </td>
            </tr>
            <tr>
                <td height="30" align="center" class="form_tdText"><b>此服务器要求安全连接(SSL)</b> </td>
                <td class="form_td">
                    <asp:CheckBox ID="cbSSL" runat="server" Text="是" />
                </td>
            </tr>
            <tr>
                <td colspan="2" class="form_td">
                    <br>
                    身份验证：<br>
                    <table width="90%" cellpadding="0" cellspacing="0" style="border: solid 1px gray;">
                        <tr>
                            <td height="28px">
                                <input type="radio" name="rValidateWay" value="1" onclick="setShow(1);" />
                            </td>
                            <td>无 </td>
                        </tr>
                        <tr>
                            <td height="28px" valign="top">
                                <input type="radio" name="rValidateWay" value="2" onclick="setShow(2);" />
                            </td>
                            <td>基本<br>
                                如果您的电子邮件服务器要求在发送电子邮件时显式传入用户名和密码，请选择此选项。<br>
                                <div id="span2">
                                    发件人的用户名：<asp:TextBox ID="txtUserName" runat="server" Width="150px"></asp:TextBox><br>
                                    发件人的密&nbsp;&nbsp;码：<asp:TextBox ID="txtPassword" runat="server" Width="150px"></asp:TextBox>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td height="28px" valign="top">
                                <input type="radio" name="rValidateWay" value="3" onclick="setShow(3);" />
                            </td>
                            <td>NTLM (Windows 身份验证)<br>
                                如果您的电子邮件服务器位于局域网上，并且您使用 Windows 凭据连接到该服务器，请选择此选项。 </td>
                        </tr>
                    </table>
                    <br>
                    <asp:HiddenField ID="hf1" runat="server" />
                </td>
            </tr>
            <tr>
                <td height="30" align="center" colspan="2" class="form_td">
                    <asp:Button ID="btnUpdate" runat="server" Text="修改" CssClass="btn_default" OnClientClick="return confirm('确定要修改吗？');"
                        OnClick="btnUpdate_Click" />&nbsp;
                    <input id="Reset1" type="reset" value="重置" class="btn_default" />
                    <whir:ezValidatorButton ID="EzValidatorButton1" runat="server" ControlToBind="btnUpdate" />
                </td>
            </tr>
        </table>
        <br />
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DADADA">
            <tr>
                <td height="26" colspan="2" align="left" class="form_title"><strong>测试邮件配置</strong></td>
            </tr>
            <tr>
                <td height="30" align="center" class="form_tdText"><b>Email：</b> </td>
                <td class="form_td">
                    <asp:TextBox ID="txtEmailCs" runat="server" Width="350px"></asp:TextBox>&nbsp;
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmailCs"
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="Email格式不正确！"></asp:RegularExpressionValidator></td>
            </tr>
            <tr>
                <td height="30" align="center" colspan="2" class="form_td">
                    <asp:Button ID="btnSend" runat="server" CssClass="btn_default" Text="发送" OnClick="btnSend_Click" />&nbsp;
                </td>
            </tr>
        </table>
    </form>
</body>
</html>

<script language="javascript">
var span2 = document.getElementById("span2");
var rs = document.getElementsByName("rValidateWay");
var rc = document.getElementById("hf1").value;
for(var i=0;i<rs.length;i++)
{
    if(rc == rs[i].value)
        rs[i].checked = true;
    else
        rs[i].checked = false;
}
if(rs[1].checked)
    span2.style.display = "";
else
    span2.style.display = "none";

function setShow(str)
{
    var span = document.getElementById("span2");
    
    if(str == 2)
    {
        span.style.display = "";
    }
    else
    {
        span.style.display = "none";
    }
}
</script>

<script language="javascript" src="../../Js/common.js"></script>

<script type="text/javascript">initAutoFormStyle();</script>

